package mapproviderapi;

import java.io.Serializable;

public class Coordinate implements Serializable {
	private double latitude;
	
	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	private double longitude;
	
	public Coordinate(){		
	}
	
	public Coordinate(double latitude, double longitude){
		this.latitude = latitude;
		this.longitude = longitude;
	}
	
	@Override
	public int hashCode(){
		final int prime = 31;
		int result = 1;
		
		result *= prime + longitude;
		result *= prime + latitude;
		
		return result;
	}
	
	@Override
	public boolean equals(Object obj){
		if (this == obj){
			return true;
		}
		if (!this.getClass().equals(obj.getClass())){
			return false;
		}
		Coordinate other = (Coordinate)obj;		
		if (longitude != other.longitude){
			return false;
		}
		if (latitude != other.latitude){
			return false;
		}
		return true;
	}
	
	@Override
	public String toString(){
		return String.valueOf(latitude).concat(",").concat(String.valueOf(longitude));
	}
}
